﻿@model IEnumerable<MusicManagerWeb.Models.MusicModel>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.UserId)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        @* test if match current user's id *@
        if (item.UserId == 1)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
                @*<td>
                        @Html.DisplayFor(modelItem => item.UserId)
                    </td>*@
                <td>
                    @Html.ActionLink("Edit", "Edit", new { id = item.MusicModelId }) |
                    @Html.ActionLink("Details", "Details", new { id = item.MusicModelId }) |
                    @Html.ActionLink("Delete", "Delete", new { id = item.MusicModelId })
                </td>
            </tr>
        }
    }

</table>
